package top.z.work.module.system.api;

import jakarta.annotation.Resource;
import org.springframework.stereotype.Service;
import top.z.work.module.system.api.authorize.AuthorizeServiceApi;
import top.z.work.module.system.service.PermissionService;

import java.util.List;

@Service
public class AuthorizeServiceApiImpl implements AuthorizeServiceApi {

    @Resource
    private PermissionService permissionService;

    /**
     * 根据UserId获取角色列表
     *
     * @param userId userId
     * @return 角色列表
     */
    @Override
    public List<String> roleList(Long userId) {
        return permissionService.getUserRoleCodeListFromCache(userId);
    }

    /**
     * 根据UserId获取权限列表
     *
     * @param userId userId
     * @return 权限列表
     */
    @Override
    public List<String> permissionList(Long userId) {
        return permissionService.getUserPermissionListFromCache(userId);
    }
}
